<div id="city-custom-bar2" style=" height: 100%">

</div>
<script type="text/javascript">
    $(function () {
        $.ajax({
            url: "#springUrl('/network/city/order/material/bar2')",
            data: {"batchId": "$!{batchId}"},
            type: "POST",
            success: function (text) {
                var d = JSON.parse(text);
                if (d.success && d.data) {
                    var myChart = echarts.init(document.getElementById('city-custom-bar2'), 'macarons');
                    var option = {
                        title: {
                            text: '',
                            show: false
                        },
                        tooltip: {
                            trigger: 'axis'
                        },
                        toolbox: {
                            feature: {

                            }
                        },
                        calculable: true,
                        xAxis: [
                            {
                                type: 'category',
                                data: d.data.x,
                                axisLabel:{
                                    show:true,
                                    interval:0,
                                    rotate:45,//倾斜度 -90 至 90 默认为0
                                    textStyle:{
                                        color:"#595959"
                                    }
                                },
                                axisLine: {
                                    show: false
                                },
                                axisTick: {
                                    show: false
                                },
                            }
                        ],
                        yAxis: [
                            {
                                type: 'value',
                                axisLine: {
                                    show: false
                                },
                                axisTick: {
                                    show: false
                                },
                                axisLabel: {
                                    formatter: function(value){
                                        var var1=value*1;
                                        return var1;
                                    },
                                    textStyle:{
                                        color:"#595959"
                                    }
                                },
                                splitLine:{
                                    show:true
                                },
                                splitArea: {
                                    show: true,
                                    areaStyle: {
                                        color: ['rgba(0,0,0,0)', 'rgba(0,0,0,0)']
                                    }
                                },
                            }
                        ],
                        legend: {
                            //data: ['物料种类数量']
                        },
                        grid: {
                            left: '3%',
                            right: '4%',
                            bottom: '9%',
                            top:'5%',
                            containLabel: true
                        },
                        barWidth:15,
                        series: [
                            {
                                name: '物料种类数量',
                                type: 'bar',
                                data:  d.data.s1,

                                itemStyle: {
                                    normal: {
                                        //好，这里就是重头戏了，定义一个list，然后根据所以取得不同的值，这样就实现了，
                                        color:  '#0fa99d',
                                        //以下为是否显示，显示位置和显示格式的设置了
                                    }}
                            }
                        ]
                    };
                    myChart.setOption(option);
                    document.getElementById("loading").style.display="none";
                }else{
                    document.getElementById("loading").style.display="none";
                    var mes1=d.message;
                    var div1="<div type='text' style='margin-top:15%' class=' text-center  '>"+mes1+"</div>";
                    $("#city-custom-bar2").empty();
                    $("#city-custom-bar2").prepend(div1);
                }
            }
        })
    });
</script>
